package game;

import java.util.Random;

/**
 * @author Psycho
 * @create 2021-07-18-19:29
 *
 *节点类，蛇身跟食物
 */
public class Node {
    private int x;
    private int y;

    public Node() {
    }

    public Node(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    //设置一个随机生成食物
    public void random(){
        Random random = new Random();
        this.x = random.nextInt(40);
        this.y = random.nextInt(40);
    }
}
